<!--
 * @Description: 流程预测
-->
<template>
  <div style="width: 100%; height: 100%">
    <ProcessTitle style="margin-bottom: 10px" :icon="'vp-liuchengyuce'" :name="this.$i18n('collaboration.summary.processAssiant.label4.js')" v-if="showHeader" />
    <iframe height="100%" class="prediction layui-layer-load" :src="iframeUrl"></iframe>
  </div>
</template>
<script>
  import ProcessTitle from '@/components/process-title';
  // 引入相关数据
  import { useBaseInfoStore } from '@/store/modules/base-info.js';
  import { mapState } from 'pinia';
  import createHandles from '@/handles/handle-list/create';
  import globalData from '@/plugins/data';

  export default {
    name: 'PredictionWorkflow',
    components: {
      ProcessTitle
    },
    props: {
      showHeader: {
        type: Boolean,
        default: false
      }
    },
    data: function () {
      return {
        key: ''
      };
    },
    computed: {
      ...mapState(useBaseInfoStore, ['baseInfo']),
      iframeUrl() {
        const {
          template: { id: templateId, formAppId: formId },
          summary: { id: summaryId, processId },
          affair: { activityId: currentNodeId }
        } = this.baseInfo.businessData;
        const formDataId = _getZWIframe().contentAPI.getContentDataId();
        //区分新建和处理
        return globalData.isSummary
          ? `${globalData.ctxPath}/workflowPrediction.do?method=prediction&summaryId=${summaryId}&formDataId=&formId=${formId}&templateId=${templateId}&processId=${processId}&currentNodeId=${currentNodeId}`
          : `${globalData.ctxPath}/workflowPrediction.do?method=prediction&summaryId=${summaryId}&formDataId=${formDataId}&formId=${formId}&templateId=${templateId}&processId=&currentNodeId=start&rnd=${this.key}`;
      }
    },

    methods: {
      async reload() {
        await createHandles.preSubmit();
        this.key = new Date();
      }
    }
  };
</script>

<style lang="scss" scoped>
  .prediction {
    $gap: 20;

    // width: $right-panel-width - $gap * 2 + px;
    width: 100%;
    // padding: 0 10px;
    // margin-left: $gap + px;
  }
</style>
